-
Notifications
You must be signed in to change notification settings - Fork 619
[SDK] Optimize ERC20 transferBatch #5256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: f98059c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Your org has enabled the Graphite merge queue for merging into mainAdd the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
size-limit report 📦
|
| } else { | ||
| amountWei = item.amountWei; | ||
| } | ||
| const matchingIndex = optimizedData.findIndex( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit messy. You should use reduce for this use case. Very useful to transform an array into a map (de duping keys in the process). Then you can get an array back from the map by just getting all the entries
017315e to
5ed2983
Compare
5ed2983 to
875ede4
Compare
875ede4 to
f1c98a1
Compare
f1c98a1 to
634e062
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5256 +/- ##
==========================================
+ Coverage 45.44% 45.47% +0.02%
==========================================
Files 1067 1067
Lines 55459 55486 +27
Branches 4009 4013 +4
==========================================
+ Hits 25206 25230 +24
- Misses 29562 29565 +3
Partials 691 691
*This pull request uses carry forward flags. Click here to find out more.
|
Merge activity
|
## Problem solved
Short description of the bug fixed or feature added
<!-- start pr-codex -->
---
## PR-Codex overview
This PR focuses on optimizing the `transferBatch` functionality for ERC20 tokens by improving the way transfers are processed, allowing for batching of transfers to the same recipient, and enhancing the test coverage for these changes.
### Detailed summary
- Added `optimizeTransferContent` function to group transfers by recipient.
- Refactored `transferBatch` to use optimized transfer content.
- Updated tests to verify optimized transfers and ensure correctness.
- Increased token minting in tests from 100 to 200 tokens.
- Enhanced test cases to validate optimized transfer behavior.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
634e062 to
f98059c
Compare

Problem solved
Short description of the bug fixed or feature added
PR-Codex overview
This PR focuses on optimizing the
transferBatchfunctionality for ERC20 token transfers by implementing a new method to group and consolidate transfer records, reducing redundant transactions.Detailed summary
optimizeTransferContentfunction to consolidate transfers with the same recipient.transferBatchto utilize optimized transfer data.